package com.example.app.components.MyModalBottomSheet

import androidx.compose.foundation.layout.BoxScope
import androidx.compose.foundation.layout.ColumnScope
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.RowScope
import androidx.compose.foundation.layout.WindowInsets
import androidx.compose.material3.BottomSheetDefaults
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.ModalBottomSheetDefaults
import androidx.compose.material3.ModalBottomSheetProperties
import androidx.compose.material3.SheetState
import androidx.compose.material3.contentColorFor
import androidx.compose.material3.rememberModalBottomSheetState
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Shape
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import com.example.app.components.MyBottomAppBar.MyBottomAppBar
import com.example.app.components.MyScaffold.MyCustomScaffold
import com.example.app.components.MyScaffold.MyScaffold
import com.example.app.components.MyScaffold.MyScaffoldHasTipAndLoading
import com.example.app.components.MyTopBar.MyTopBar

@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun MyModalBottomSheetCustomTopBarAndBottomBar(
    onDismissRequest: () -> Unit,
    modifier: Modifier = Modifier,
    contentBoxWrapModifier: Modifier? = null,
    sheetState: SheetState = rememberModalBottomSheetState(),
    sheetMaxWidth: Dp = BottomSheetDefaults.SheetMaxWidth,
    shape: Shape = BottomSheetDefaults.ExpandedShape,
    //containerColor: Color = BottomSheetDefaults.ContainerColor,
    containerColor: Color = MaterialTheme.colorScheme.surface,
    contentColor: Color = contentColorFor(containerColor),
    tonalElevation: Dp = 0.dp,
    scrimColor: Color = BottomSheetDefaults.ScrimColor,
    dragHandle: @Composable (() -> Unit)? = null,
    contentWindowInsets: @Composable () -> WindowInsets = { BottomSheetDefaults.windowInsets },
    properties: ModalBottomSheetProperties = ModalBottomSheetDefaults.properties,
    content: @Composable BoxScope.() -> Unit,
    topBarTitle: @Composable () -> Unit,
    topBarActions: @Composable () -> Unit,
    topNavigationIcon: @Composable () -> Unit,
    bottomAppBarContent: (@Composable BoxScope.() -> Unit)? = null,
) {
    MyModalBottomSheet(
        onDismissRequest = onDismissRequest,
        modifier = modifier,
        sheetState = sheetState,
        sheetMaxWidth = sheetMaxWidth,
        shape = shape,
        containerColor = containerColor,
        contentColor = contentColor,
        tonalElevation = tonalElevation,
        scrimColor = scrimColor,
        dragHandle = dragHandle,
        contentWindowInsets = contentWindowInsets,
        properties = properties,
        content = {
            MyCustomScaffold(
                topBar = {
                    MyTopBar(
                        title = { topBarTitle() },
                        windowInsets = WindowInsets(
                            0,
                            0,
                            0,
                            0
                        ),
                        actions = {
                            topBarActions()
                        },
                        navigationIcon = {
                            topNavigationIcon()
                        }
                    )
                },
                content = content,
                bottomBar = bottomAppBarContent
            )
        }
    )
}